<script>

function mostraLista(mesa, obj){
	//$(obj).css("float", "");
	$(".lista_mesa_"+mesa).slideDown('fast');
}

function excluirItem(id){
	$.post('<?php echo $this->base?>/pedido/delete-item', {id: id}, function(){
		msg({vmsg: 'Item deletado com sucesso.'});

		$('.excl_it').click();
	});
}

function excluirPedido(cod){
	$.post("pedido/excluir-pedido",{cod:cod},function(){$('.excl_it').click();});
}


</script>
<style>
.list_all_menu .lista{
	display: none;
	background: red;
	z-index: 999;
	position: absolute;
	width: 500px;
	font-size: 18px;
	color: white;
	padding:10px;
	border: 1px solid gray;
	margin: 0 auto;
}
</style>
<?php //Zend_Debug::dump($this->arr);?>
<div class="ui-corner-all list_all_menu" style="margin-top: 10px; width: 810px; margin: 0 auto; margin-bottom: 1px;">
	<div style="margin-bottom: 10px; height: 30px;">
	<div style="float: right;">
	<div class="button ui-corner-all" onclick="$('#check_mostra_todos').click()" 
	style=" display: none; background: white; padding: 8px; width: 170px; border: 0;">
		<div style="float: left; position: relative;">
			<input type="checkbox" id="check_mostra_todos" onclick="listaMesas();" />
		</div>
		<div style="margin-top: 1px; font-size: 15px;">
			&nbsp;Mostrar todas mesas
		</div>
	</div>
	</div>
	<div style="float: right; text-align: right; width: 200px; margin-top: 10px; margin-right: 3px;">
		<label id='load_subproduct' style='display: none;'>&nbsp;<img src='<?php $this->base; ?>/public/images/ajax-loader.gif' /></label>
	</div>
	<div style="float: left; width: 400px; font-size: 22px; margin-top: 8px;">
		Selecione uma Mesa para exlcuir item.
	</div>
	</div>
	<hr style="margin-bottom: 10px;" />	
	
	<?php if(!$this->total_ped): ?>
		<?php echo $this->partial("helpers/msgvazio.phtml", array("msg" => "Nenhum Pedido Pendente.")); ?>
	<?php else: ?>
		<?php foreach($this->total_ped as $k => $v): ?>
			
			<div
			onclick="mostraLista('<?php echo $v[0]["caf02_cod"]; ?>', this);" 
			class="button ui-corner-all" type="button"
			style="font-size: 12px; padding-top: 15px; text-align: center; 
			width: 90px; height: 70px; margin: 5px; border: 1px solid gray; border-top: 0; 
			border-right: 0;z-index: 997; float: left;">
				<?php echo $k; ?>
				<?php //Zend_Debug::dump($v); exit;?>
			</div>
			<div class="lista lista_mesa_<?php echo $v[0]["caf02_cod"]; ?> ui-corner-all">
				Clique no item para excluir.
				<hr style="margin: 10px 0 10px 0;" />
				<?php foreach($v as $prod): ?>
				<div style="padding-bottom: 10px; padding-top: 10px; border-bottom: 2px solid white;" 
				onclick="excluirItem('<?php echo $prod['caf04_cod']?>');">
					<?php echo $prod["caf05_prod"]."(".$prod["caf05_car"].")".$prod["caf05_valor"]; ?>
				</div>
				<?php endforeach; ?>
				<hr style="border-top: 1px dashed gray; margin-top: 5px; margin-bottom: 5px;" />
				<div>
					<div class="button ui-corner-all" onclick="$('.excl_it').click();" 
					style="text-align: center; float: left; padding: 20px; width: 201px; color: black">
						<b>Voltar</b>
					</div>
					<div id="proximo_passo" class="button ui-corner-all" onclick="$('.excl_it').click();" 
					style="text-align: center; padding: 20px; margin-left: 256px; width: 201px; color: black;">
						<b>Salvar</b>
					</div>
					<div id="excluir_mesa" class="button ui-corner-all" onclick="excluirPedido(<?php echo $v[0]["caf02_cod"]; ?>);" 
					style="text-align: center; padding: 20px; margin-top: 10px; color: black;">
						<b>Excluir Pedido</b>
					</div>
				</div>
			</div>
		<?php endforeach; ?>
	<?php endif; ?>
</div>